Skip to content

fix(laravel): keep the validation rules of a parameter - #8924

Merged
soyuka merged 1 commit into
api-platform:5.0from
Maxcastel:fix/laravel-parameter-user-constraints
Dec 2, 2026
Merged

soyuka merged 1 commit into
api-platform:5.0from
Maxcastel:fix/laravel-parameter-user-constraints

Conversation

@Maxcastel

@Maxcastel Maxcastel commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor
Q A
Branch? 5.0
License MIT
Doc PR api-platform/docs#2381

On Laravel the rules generated from required/schema replaced the constraints of the parameter.

With QueryParameter(constraints: 'min:2', required: true) only required was checked, so ?isbn=a passed. The docs say the rules can be customized with constraints.

Same as Symfony now: when the parameter has constraints, they're used as is and nothing is generated (so required goes in the constraints too).

@soyuka
soyuka merged commit 738eea2 into api-platform:5.0 Dec 2, 2026
114 of 117 checks passed
@soyuka

soyuka commented Dec 2, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants